home *** CD-ROM | disk | FTP | other *** search
- Path: locutus.rchland.ibm.com!usenet
- From: pstaite@vnet.ibm.com
- Newsgroups: comp.lang.c++
- Subject: Re: Compile problem
- Date: 1 Feb 1996 22:45:10 GMT
- Organization: IBM OS/2 Device Driver Development Rochester, MN
- Message-ID: <4erfpm$16iq@locutus.rchland.ibm.com>
- References: <4eol9k$gqf@fred.uswnvg.com>
- Reply-To: pstaite@vnet.ibm.com
- NNTP-Posting-Host: warpone.rchland.ibm.com
- X-Newsreader: IBM NewsReader/2 v1.2
-
- In <4eol9k$gqf@fred.uswnvg.com>, jweddle@uswnvg.com (Jacque Weddle) writes:
- >Hello,
- >
- >I'm a c person trying to compile some c++ code I got
- >off the net. I get the error message
- >
- >"Log.cc", line 261: error: jump past initializer (did you forget a '{ }'?)
-
- Although you didn't post the code I'll bet the problem line is within a
- switch() statement. Something like:
-
-
- switch( foo ) {
- case x:
- sometype t;
- break;
- case y:
- // do something
- break;
- etc...
-
- The complaint is that the compiler feels that in the case of foo being y
- the sometype instance t is in scope, but hasn't been initialized. The
- way to avoid this is to add {} around that case:
-
- switch( foo ) {
- case x:
- {
- sometype t;
- }
- break;
- case y:
- // do something
- break;
- etc...
-
- This provides a local scope for t and keeps the compiler happy.
-
-
-
- Phil Staite, team OS/2
- internet: pstaite@vnet.ibm.com internal: pstaite@rchland
-
-